library(tidyverse)
library(broom)

# Load data

# Study 1
S1_d <- read_csv("study1_clean.csv") %>%
  mutate(
    Gender = as.factor(Gender),
    Race = as.factor(Race),
    AI_heard_positive = as.factor(AI_heard_positive),
    AI_use = as.factor(AI_use),
    group = as.factor(group)
  )

# Study 2
S2_d <- read_csv("study2_clean.csv") %>%
  mutate(
    gender = as.factor(gender),
    ai_use = as.factor(ai_use),
    knowl_bin = as.factor(knowl_bin),
    group = as.factor(group)
  )

# Study 3
S3_d <- read_csv("study3_clean.csv") %>%
  mutate(
    gender = as.factor(gender),
    ai_use = as.factor(ai_use),
    knowl_bin = as.factor(knowl_bin),
    group = as.factor(group)
  )

# Create the subsets for each treatment comparison
S1_d_existential <- S1_d %>%
  filter(group %in% c("control", "existential")) %>%
  mutate(existential = as.numeric(group == "existential"))

S1_d_immediate <- S1_d %>%
  filter(group %in% c("control", "immediate")) %>%
  mutate(immediate = as.numeric(group == "immediate"))

S1_d_benefits <- S1_d %>%
  filter(group %in% c("control", "benefits")) %>%
  mutate(benefits = as.numeric(group == "benefits"))

S2_d_existential <- S2_d %>%
  filter(group %in% c("control", "existential")) %>%
  mutate(existential = as.numeric(group == "existential"))

S2_d_immediate <- S2_d %>%
  filter(group %in% c("control", "immediate")) %>%
  mutate(immediate = as.numeric(group == "immediate"))

S2_d_benefits <- S2_d %>%
  filter(group %in% c("control", "benefits")) %>%
  mutate(benefits = as.numeric(group == "benefits"))

S3_d_existential <- S3_d %>%
  filter(group %in% c("control", "existential")) %>%
  mutate(existential = as.numeric(group == "existential"))

S3_d_immediate <- S3_d %>%
  filter(group %in% c("control", "immediate")) %>%
  mutate(immediate = as.numeric(group == "immediate"))

S3_d_benefits <- S3_d %>%
  filter(group %in% c("control", "benefits")) %>%
  mutate(benefits = as.numeric(group == "benefits"))


# Regressions

# Study 1

S1_table <- tibble(
  outcome = NA,
  treatment = NA,
  coef = NA,
  pval = NA,
  pval_adj = NA
)

S1_h1a <- lm(likert_immediate ~ existential + Gender + Age + Race + Education + Ideology + Political_interest + AI_heard_positive + AI_use, data = S1_d_existential)

  S1_table[1,1] <- all.vars(formula(S1_h1a))[1]
  S1_table[1,2] <- all.vars(formula(S1_h1a))[2]
  S1_table[1,3] <- summary(S1_h1a)$coefficients[2,1]
  S1_table[1,4] <- summary(S1_h1a)$coefficients[2,4]

S1_h1b <- lm(rank_immediate ~ existential + Gender + Age + Race + Education + Ideology + Political_interest + AI_heard_positive + AI_use, data = S1_d_existential)

  S1_table[2,1] <- all.vars(formula(S1_h1b))[1]
  S1_table[2,2] <- all.vars(formula(S1_h1b))[2]
  S1_table[2,3] <- summary(S1_h1b)$coefficients[2,1]
  S1_table[2,4] <- summary(S1_h1b)$coefficients[2,4]

S1_h2a <- lm(likert_misperception ~ existential + Gender + Age + Race + Education + Ideology + Political_interest + AI_heard_positive + AI_use, data = S1_d_existential)

  S1_table[3,1] <- all.vars(formula(S1_h2a))[1]
  S1_table[3,2] <- all.vars(formula(S1_h2a))[2]
  S1_table[3,3] <- summary(S1_h2a)$coefficients[2,1]
  S1_table[3,4] <- summary(S1_h2a)$coefficients[2,4]

S1_h2b <- lm(rank_misperception ~ existential + Gender + Age + Race + Education + Ideology + Political_interest + AI_heard_positive + AI_use, data = S1_d_existential)

  S1_table[4,1] <- all.vars(formula(S1_h2b))[1]
  S1_table[4,2] <- all.vars(formula(S1_h2b))[2]
  S1_table[4,3] <- summary(S1_h2b)$coefficients[2,1]
  S1_table[4,4] <- summary(S1_h2b)$coefficients[2,4]

S1_h3a <- lm(click_petition ~ existential + Gender + Age + Race + Education + Ideology + Political_interest + AI_heard_positive + AI_use, data = S1_d_existential)

  S1_table[5,1] <- all.vars(formula(S1_h3a))[1]
  S1_table[5,2] <- all.vars(formula(S1_h3a))[2]
  S1_table[5,3] <- summary(S1_h3a)$coefficients[2,1]
  S1_table[5,4] <- summary(S1_h3a)$coefficients[2,4]

S1_h3b <- lm(click_petition ~ immediate + Gender + Age + Race + Education + Ideology + Political_interest + AI_heard_positive + AI_use, data = S1_d_immediate)

  S1_table[6,1] <- all.vars(formula(S1_h3b))[1]
  S1_table[6,2] <- all.vars(formula(S1_h3b))[2]
  S1_table[6,3] <- summary(S1_h3b)$coefficients[2,1]
  S1_table[6,4] <- summary(S1_h3b)$coefficients[2,4]

S1_h4a <- lm(likert_immediate ~ immediate + Gender + Age + Race + Education + Ideology + Political_interest + AI_heard_positive + AI_use, data = S1_d_immediate)

  S1_table[7,1] <- all.vars(formula(S1_h4a))[1]
  S1_table[7,2] <- all.vars(formula(S1_h4a))[2]
  S1_table[7,3] <- summary(S1_h4a)$coefficients[2,1]
  S1_table[7,4] <- summary(S1_h4a)$coefficients[2,4]

S1_h4b <- lm(rank_immediate ~ immediate + Gender + Age + Race + Education + Ideology + Political_interest + AI_heard_positive + AI_use, data = S1_d_immediate) 

  S1_table[8,1] <- all.vars(formula(S1_h4b))[1]
  S1_table[8,2] <- all.vars(formula(S1_h4b))[2]
  S1_table[8,3] <- summary(S1_h4b)$coefficients[2,1]
  S1_table[8,4] <- summary(S1_h4b)$coefficients[2,4]

S1_h5a <- lm(likert_existential ~ existential + Gender + Age + Race + Education + Ideology + Political_interest + AI_heard_positive + AI_use, data = S1_d_existential)

  S1_table[9,1] <- all.vars(formula(S1_h5a))[1]
  S1_table[9,2] <- all.vars(formula(S1_h5a))[2]
  S1_table[9,3] <- summary(S1_h5a)$coefficients[2,1]
  S1_table[9,4] <- summary(S1_h5a)$coefficients[2,4]

S1_h5b <- lm(rank_existential ~ existential + Gender + Age + Race + Education + Ideology + Political_interest + AI_heard_positive + AI_use, data = S1_d_existential)

  S1_table[10,1] <- all.vars(formula(S1_h5b))[1]
  S1_table[10,2] <- all.vars(formula(S1_h5b))[2]
  S1_table[10,3] <- summary(S1_h5b)$coefficients[2,1]
  S1_table[10,4] <- summary(S1_h5b)$coefficients[2,4]

S1_h6 <- lm(likert_benefits ~ benefits + Gender + Age + Race + Education + Ideology + Political_interest + AI_heard_positive + AI_use, data = S1_d_benefits)

  S1_table[11,1] <- all.vars(formula(S1_h6))[1]
  S1_table[11,2] <- all.vars(formula(S1_h6))[2]
  S1_table[11,3] <- summary(S1_h6)$coefficients[2,1]
  S1_table[11,4] <- summary(S1_h6)$coefficients[2,4]

S1_h7a <- lm(likert_existential ~ benefits + Gender + Age + Race + Education + Ideology + Political_interest + AI_heard_positive + AI_use, data = S1_d_benefits)

  S1_table[12,1] <- all.vars(formula(S1_h7a))[1]
  S1_table[12,2] <- all.vars(formula(S1_h7a))[2]
  S1_table[12,3] <- summary(S1_h7a)$coefficients[2,1]
  S1_table[12,4] <- summary(S1_h7a)$coefficients[2,4]

S1_h7b <- lm(rank_existential ~ benefits + Gender + Age + Race + Education + Ideology + Political_interest + AI_heard_positive + AI_use, data = S1_d_benefits)

  S1_table[13,1] <- all.vars(formula(S1_h7b))[1]
  S1_table[13,2] <- all.vars(formula(S1_h7b))[2]
  S1_table[13,3] <- summary(S1_h7b)$coefficients[2,1]
  S1_table[13,4] <- summary(S1_h7b)$coefficients[2,4]

S1_h8a <- lm(likert_immediate ~ benefits + Gender + Age + Race + Education + Ideology + Political_interest + AI_heard_positive + AI_use, data = S1_d_benefits)

  S1_table[14,1] <- all.vars(formula(S1_h8a))[1]
  S1_table[14,2] <- all.vars(formula(S1_h8a))[2]
  S1_table[14,3] <- summary(S1_h8a)$coefficients[2,1]
  S1_table[14,4] <- summary(S1_h8a)$coefficients[2,4]

S1_h8b <- lm(rank_immediate ~ benefits + Gender + Age + Race + Education + Ideology + Political_interest + AI_heard_positive + AI_use, data = S1_d_benefits)

  S1_table[15,1] <- all.vars(formula(S1_h8b))[1]
  S1_table[15,2] <- all.vars(formula(S1_h8b))[2]
  S1_table[15,3] <- summary(S1_h8b)$coefficients[2,1]
  S1_table[15,4] <- summary(S1_h8b)$coefficients[2,4]

S1_h9a <- lm(likert_misperception ~ benefits + Gender + Age + Race + Education + Ideology + Political_interest + AI_heard_positive + AI_use, data = S1_d_benefits)

  S1_table[16,1] <- all.vars(formula(S1_h9a))[1]
  S1_table[16,2] <- all.vars(formula(S1_h9a))[2]
  S1_table[16,3] <- summary(S1_h9a)$coefficients[2,1]
  S1_table[16,4] <- summary(S1_h9a)$coefficients[2,4]

S1_h9b <- lm(rank_misperception ~ benefits + Gender + Age + Race + Education + Ideology + Political_interest + AI_heard_positive + AI_use, data = S1_d_benefits)

  S1_table[17,1] <- all.vars(formula(S1_h9b))[1]
  S1_table[17,2] <- all.vars(formula(S1_h9b))[2]
  S1_table[17,3] <- summary(S1_h9b)$coefficients[2,1]
  S1_table[17,4] <- summary(S1_h9b)$coefficients[2,4]


S1_h <- c("H1a", "H1b", "H2a", "H2b", "H3a", "H3b", "H4a", "H4b", "H5a", "H5b", "H6", "H7a", "H7b", "H8a", "H8b", "H9a", "H9b")

S1_table <- S1_table %>%
  mutate(
    pval_adj = p.adjust(pval, method = "BH", n = 17),
    hypothesis = S1_h
  )

print(S1_table, n = 100)

# Study 2

S2_table <- tibble(
  outcome = NA,
  treatment = NA,
  coef = NA,
  pval = NA,
  pval_adj = NA
)

S2_1a_lik <- lm(existential_lik ~ existential + gender + age + education + ideology + political_interest + ai_heard_positive + ai_use + ai_awareness + knowl_bin + country, data = S2_d_existential)

  S2_table[1,1] <- all.vars(formula(S2_1a_lik))[1]
  S2_table[1,2] <- all.vars(formula(S2_1a_lik))[2]
  S2_table[1,3] <- summary(S2_1a_lik)$coefficients[2,1]
  S2_table[1,4] <- summary(S2_1a_lik)$coefficients[2,4]

S2_1a_imp <- lm(existential_imp ~ existential + gender + age + education + ideology + political_interest + ai_heard_positive + ai_use + ai_awareness + knowl_bin + country, data = S2_d_existential)

  S2_table[2,1] <- all.vars(formula(S2_1a_imp))[1]
  S2_table[2,2] <- all.vars(formula(S2_1a_imp))[2]
  S2_table[2,3] <- summary(S2_1a_imp)$coefficients[2,1]
  S2_table[2,4] <- summary(S2_1a_imp)$coefficients[2,4]

S2_1b_lik <- lm(er_rank_lik_rev ~ existential + gender + age + education + ideology + political_interest + ai_heard_positive + ai_use + ai_awareness + knowl_bin + country, data = S2_d_existential)

  S2_table[3,1] <- all.vars(formula(S2_1b_lik))[1]
  S2_table[3,2] <- all.vars(formula(S2_1b_lik))[2]
  S2_table[3,3] <- summary(S2_1b_lik)$coefficients[2,1]
  S2_table[3,4] <- summary(S2_1b_lik)$coefficients[2,4]

S2_1b_imp <- lm(er_rank_imp_rev ~ existential + gender + age + education + ideology + political_interest + ai_heard_positive + ai_use + ai_awareness + knowl_bin + country, data = S2_d_existential)

  S2_table[4,1] <- all.vars(formula(S2_1b_imp))[1]
  S2_table[4,2] <- all.vars(formula(S2_1b_imp))[2]
  S2_table[4,3] <- summary(S2_1b_imp)$coefficients[2,1]
  S2_table[4,4] <- summary(S2_1b_imp)$coefficients[2,4]

S2_2a_lik <- lm(imminent_lik ~ existential + gender + age + education + ideology + political_interest + ai_heard_positive + ai_use + ai_awareness + knowl_bin + country, data = S2_d_existential)

  S2_table[5,1] <- all.vars(formula(S2_2a_lik))[1]
  S2_table[5,2] <- all.vars(formula(S2_2a_lik))[2]
  S2_table[5,3] <- summary(S2_2a_lik)$coefficients[2,1]
  S2_table[5,4] <- summary(S2_2a_lik)$coefficients[2,4]

S2_2a_imp <- lm(imminent_imp ~ existential + gender + age + education + ideology + political_interest + ai_heard_positive + ai_use + ai_awareness + knowl_bin + country, data = S2_d_existential)

  S2_table[6,1] <- all.vars(formula(S2_2a_imp))[1]
  S2_table[6,2] <- all.vars(formula(S2_2a_imp))[2]
  S2_table[6,3] <- summary(S2_2a_imp)$coefficients[2,1]
  S2_table[6,4] <- summary(S2_2a_imp)$coefficients[2,4]

S2_2b_lik <- lm(ir_rank_lik_rev ~ existential + gender + age + education + ideology + political_interest + ai_heard_positive + ai_use + ai_awareness + knowl_bin + country, data = S2_d_existential)

  S2_table[7,1] <- all.vars(formula(S2_2b_lik))[1]
  S2_table[7,2] <- all.vars(formula(S2_2b_lik))[2]
  S2_table[7,3] <- summary(S2_2b_lik)$coefficients[2,1]
  S2_table[7,4] <- summary(S2_2b_lik)$coefficients[2,4]

S2_2b_imp <- lm(ir_rank_imp_rev ~ existential + gender + age + education + ideology + political_interest + ai_heard_positive + ai_use + ai_awareness + knowl_bin + country, data = S2_d_existential)

  S2_table[8,1] <- all.vars(formula(S2_2b_imp))[1]
  S2_table[8,2] <- all.vars(formula(S2_2b_imp))[2]
  S2_table[8,3] <- summary(S2_2b_imp)$coefficients[2,1]
  S2_table[8,4] <- summary(S2_2b_imp)$coefficients[2,4]

S2_3a_lik <- lm(conspiracy_lik ~ existential + gender + age + education + ideology + political_interest + ai_heard_positive + ai_use + ai_awareness + knowl_bin + country, data = S2_d_existential)

  S2_table[9,1] <- all.vars(formula(S2_3a_lik))[1]
  S2_table[9,2] <- all.vars(formula(S2_3a_lik))[2]
  S2_table[9,3] <- summary(S2_3a_lik)$coefficients[2,1]
  S2_table[9,4] <- summary(S2_3a_lik)$coefficients[2,4]

S2_3a_imp <- lm(conspiracy_imp ~ existential + gender + age + education + ideology + political_interest + ai_heard_positive + ai_use + ai_awareness + knowl_bin + country, data = S2_d_existential)

  S2_table[10,1] <- all.vars(formula(S2_3a_imp))[1]
  S2_table[10,2] <- all.vars(formula(S2_3a_imp))[2]
  S2_table[10,3] <- summary(S2_3a_imp)$coefficients[2,1]
  S2_table[10,4] <- summary(S2_3a_imp)$coefficients[2,4]

S2_3b_lik <- lm(cr_rank_lik_rev ~ existential + gender + age + education + ideology + political_interest + ai_heard_positive + ai_use + ai_awareness + knowl_bin + country, data = S2_d_existential)

  S2_table[11,1] <- all.vars(formula(S2_3b_lik))[1]
  S2_table[11,2] <- all.vars(formula(S2_3b_lik))[2]
  S2_table[11,3] <- summary(S2_3b_lik)$coefficients[2,1]
  S2_table[11,4] <- summary(S2_3b_lik)$coefficients[2,4]

S2_3b_imp <- lm(cr_rank_imp_rev ~ existential + gender + age + education + ideology + political_interest + ai_heard_positive + ai_use + ai_awareness + knowl_bin + country, data = S2_d_existential)

  S2_table[12,1] <- all.vars(formula(S2_3b_imp))[1]
  S2_table[12,2] <- all.vars(formula(S2_3b_imp))[2]
  S2_table[12,3] <- summary(S2_3b_imp)$coefficients[2,1]
  S2_table[12,4] <- summary(S2_3b_imp)$coefficients[2,4]

S2_4a_lik <- lm(existential_lik ~ immediate + gender + age + education + ideology + political_interest + ai_heard_positive + ai_use + ai_awareness + knowl_bin + country, data = S2_d_immediate)

  S2_table[13,1] <- all.vars(formula(S2_4a_lik))[1]
  S2_table[13,2] <- all.vars(formula(S2_4a_lik))[2]
  S2_table[13,3] <- summary(S2_4a_lik)$coefficients[2,1]
  S2_table[13,4] <- summary(S2_4a_lik)$coefficients[2,4]

S2_4a_imp <- lm(existential_imp ~ immediate + gender + age + education + ideology + political_interest + ai_heard_positive + ai_use + ai_awareness + knowl_bin + country, data = S2_d_immediate)

  S2_table[14,1] <- all.vars(formula(S2_4a_imp))[1]
  S2_table[14,2] <- all.vars(formula(S2_4a_imp))[2]
  S2_table[14,3] <- summary(S2_4a_imp)$coefficients[2,1]
  S2_table[14,4] <- summary(S2_4a_imp)$coefficients[2,4]

S2_4b_lik <- lm(er_rank_lik_rev ~ immediate + gender + age + education + ideology + political_interest + ai_heard_positive + ai_use + ai_awareness + knowl_bin + country, data = S2_d_immediate)

  S2_table[15,1] <- all.vars(formula(S2_4b_lik))[1]
  S2_table[15,2] <- all.vars(formula(S2_4b_lik))[2]
  S2_table[15,3] <- summary(S2_4b_lik)$coefficients[2,1]
  S2_table[15,4] <- summary(S2_4b_lik)$coefficients[2,4]

S2_4b_imp <- lm(er_rank_imp_rev ~ immediate + gender + age + education + ideology + political_interest + ai_heard_positive + ai_use + ai_awareness + knowl_bin + country, data = S2_d_immediate)

  S2_table[16,1] <- all.vars(formula(S2_4b_imp))[1]
  S2_table[16,2] <- all.vars(formula(S2_4b_imp))[2]
  S2_table[16,3] <- summary(S2_4b_imp)$coefficients[2,1]
  S2_table[16,4] <- summary(S2_4b_imp)$coefficients[2,4]

S2_5a_lik <- lm(imminent_lik ~ immediate + gender + age + education + ideology + political_interest + ai_heard_positive + ai_use + ai_awareness + knowl_bin + country, data = S2_d_immediate)

  S2_table[17,1] <- all.vars(formula(S2_5a_lik))[1]
  S2_table[17,2] <- all.vars(formula(S2_5a_lik))[2]
  S2_table[17,3] <- summary(S2_5a_lik)$coefficients[2,1]
  S2_table[17,4] <- summary(S2_5a_lik)$coefficients[2,4]

S2_5a_imp <- lm(imminent_imp ~ immediate + gender + age + education + ideology + political_interest + ai_heard_positive + ai_use + ai_awareness + knowl_bin + country, data = S2_d_immediate)

  S2_table[18,1] <- all.vars(formula(S2_5a_imp))[1]
  S2_table[18,2] <- all.vars(formula(S2_5a_imp))[2]
  S2_table[18,3] <- summary(S2_5a_imp)$coefficients[2,1]
  S2_table[18,4] <- summary(S2_5a_imp)$coefficients[2,4]

S2_5b_lik <- lm(ir_rank_lik_rev ~ immediate + gender + age + education + ideology + political_interest + ai_heard_positive + ai_use + ai_awareness + knowl_bin + country, data = S2_d_immediate)

  S2_table[19,1] <- all.vars(formula(S2_5b_lik))[1]
  S2_table[19,2] <- all.vars(formula(S2_5b_lik))[2]
  S2_table[19,3] <- summary(S2_5b_lik)$coefficients[2,1]
  S2_table[19,4] <- summary(S2_5b_lik)$coefficients[2,4]

S2_5b_imp <- lm(ir_rank_imp_rev ~ immediate + gender + age + education + ideology + political_interest + ai_heard_positive + ai_use + ai_awareness + knowl_bin + country, data = S2_d_immediate)

  S2_table[20,1] <- all.vars(formula(S2_5b_imp))[1]
  S2_table[20,2] <- all.vars(formula(S2_5b_imp))[2]
  S2_table[20,3] <- summary(S2_5b_imp)$coefficients[2,1]
  S2_table[20,4] <- summary(S2_5b_imp)$coefficients[2,4]

S2_6a_lik <- lm(conspiracy_lik ~ immediate + gender + age + education + ideology + political_interest + ai_heard_positive + ai_use + ai_awareness + knowl_bin + country, data = S2_d_immediate)

  S2_table[21,1] <- all.vars(formula(S2_6a_lik))[1]
  S2_table[21,2] <- all.vars(formula(S2_6a_lik))[2]
  S2_table[21,3] <- summary(S2_6a_lik)$coefficients[2,1]
  S2_table[21,4] <- summary(S2_6a_lik)$coefficients[2,4]

S2_6a_imp <- lm(conspiracy_imp ~ immediate + gender + age + education + ideology + political_interest + ai_heard_positive + ai_use + ai_awareness + knowl_bin + country, data = S2_d_immediate)

  S2_table[22,1] <- all.vars(formula(S2_6a_imp))[1]
  S2_table[22,2] <- all.vars(formula(S2_6a_imp))[2]
  S2_table[22,3] <- summary(S2_6a_imp)$coefficients[2,1]
  S2_table[22,4] <- summary(S2_6a_imp)$coefficients[2,4]

S2_6b_lik <- lm(cr_rank_lik_rev ~ immediate + gender + age + education + ideology + political_interest + ai_heard_positive + ai_use + ai_awareness + knowl_bin + country, data = S2_d_immediate)

  S2_table[23,1] <- all.vars(formula(S2_6b_lik))[1]
  S2_table[23,2] <- all.vars(formula(S2_6b_lik))[2]
  S2_table[23,3] <- summary(S2_6b_lik)$coefficients[2,1]
  S2_table[23,4] <- summary(S2_6b_lik)$coefficients[2,4]

S2_6b_imp <- lm(cr_rank_imp_rev ~ immediate + gender + age + education + ideology + political_interest + ai_heard_positive + ai_use + ai_awareness + knowl_bin + country, data = S2_d_immediate)

  S2_table[24,1] <- all.vars(formula(S2_6b_imp))[1]
  S2_table[24,2] <- all.vars(formula(S2_6b_imp))[2]
  S2_table[24,3] <- summary(S2_6b_imp)$coefficients[2,1]
  S2_table[24,4] <- summary(S2_6b_imp)$coefficients[2,4]

S2_7a_lik <- lm(existential_lik ~ benefits + gender + age + education + ideology + political_interest + ai_heard_positive + ai_use + ai_awareness + knowl_bin + country, data = S2_d_benefits)

  S2_table[25,1] <- all.vars(formula(S2_7a_lik))[1]
  S2_table[25,2] <- all.vars(formula(S2_7a_lik))[2]
  S2_table[25,3] <- summary(S2_7a_lik)$coefficients[2,1]
  S2_table[25,4] <- summary(S2_7a_lik)$coefficients[2,4]

S2_7a_imp <- lm(existential_imp ~ benefits + gender + age + education + ideology + political_interest + ai_heard_positive + ai_use + ai_awareness + knowl_bin + country, data = S2_d_benefits)

  S2_table[26,1] <- all.vars(formula(S2_7a_imp))[1]
  S2_table[26,2] <- all.vars(formula(S2_7a_imp))[2]
  S2_table[26,3] <- summary(S2_7a_imp)$coefficients[2,1]
  S2_table[26,4] <- summary(S2_7a_imp)$coefficients[2,4]

S2_7b_lik <- lm(er_rank_lik_rev ~ benefits + gender + age + education + ideology + political_interest + ai_heard_positive + ai_use + ai_awareness + knowl_bin + country, data = S2_d_benefits)

  S2_table[27,1] <- all.vars(formula(S2_7b_lik))[1]
  S2_table[27,2] <- all.vars(formula(S2_7b_lik))[2]
  S2_table[27,3] <- summary(S2_7b_lik)$coefficients[2,1]
  S2_table[27,4] <- summary(S2_7b_lik)$coefficients[2,4]

S2_7b_imp <- lm(er_rank_imp_rev ~ benefits + gender + age + education + ideology + political_interest + ai_heard_positive + ai_use + ai_awareness + knowl_bin + country, data = S2_d_benefits)

  S2_table[28,1] <- all.vars(formula(S2_7b_imp))[1]
  S2_table[28,2] <- all.vars(formula(S2_7b_imp))[2]
  S2_table[28,3] <- summary(S2_7b_imp)$coefficients[2,1]
  S2_table[28,4] <- summary(S2_7b_imp)$coefficients[2,4]

S2_8a_lik <- lm(imminent_lik ~ benefits + gender + age + education + ideology + political_interest + ai_heard_positive + ai_use + ai_awareness + knowl_bin + country, data = S2_d_benefits)

  S2_table[29,1] <- all.vars(formula(S2_8a_lik))[1]
  S2_table[29,2] <- all.vars(formula(S2_8a_lik))[2]
  S2_table[29,3] <- summary(S2_8a_lik)$coefficients[2,1]
  S2_table[29,4] <- summary(S2_8a_lik)$coefficients[2,4]

S2_8a_imp <- lm(imminent_imp ~ benefits + gender + age + education + ideology + political_interest + ai_heard_positive + ai_use + ai_awareness + knowl_bin + country, data = S2_d_benefits)

  S2_table[30,1] <- all.vars(formula(S2_8a_imp))[1]
  S2_table[30,2] <- all.vars(formula(S2_8a_imp))[2]
  S2_table[30,3] <- summary(S2_8a_imp)$coefficients[2,1]
  S2_table[30,4] <- summary(S2_8a_imp)$coefficients[2,4]

S2_8b_lik <- lm(ir_rank_lik_rev ~ benefits + gender + age + education + ideology + political_interest + ai_heard_positive + ai_use + ai_awareness + knowl_bin + country, data = S2_d_benefits)

  S2_table[31,1] <- all.vars(formula(S2_8b_lik))[1]
  S2_table[31,2] <- all.vars(formula(S2_8b_lik))[2]
  S2_table[31,3] <- summary(S2_8b_lik)$coefficients[2,1]
  S2_table[31,4] <- summary(S2_8b_lik)$coefficients[2,4]

S2_8b_imp <- lm(ir_rank_imp_rev ~ benefits + gender + age + education + ideology + political_interest + ai_heard_positive + ai_use + ai_awareness + knowl_bin + country, data = S2_d_benefits)

  S2_table[32,1] <- all.vars(formula(S2_8b_imp))[1]
  S2_table[32,2] <- all.vars(formula(S2_8b_imp))[2]
  S2_table[32,3] <- summary(S2_8b_imp)$coefficients[2,1]
  S2_table[32,4] <- summary(S2_8b_imp)$coefficients[2,4]

S2_9a_lik <- lm(conspiracy_lik ~ benefits + gender + age + education + ideology + political_interest + ai_heard_positive + ai_use + ai_awareness + knowl_bin + country, data = S2_d_benefits)

  S2_table[33,1] <- all.vars(formula(S2_9a_lik))[1]
  S2_table[33,2] <- all.vars(formula(S2_9a_lik))[2]
  S2_table[33,3] <- summary(S2_9a_lik)$coefficients[2,1]
  S2_table[33,4] <- summary(S2_9a_lik)$coefficients[2,4]

S2_9a_imp <- lm(conspiracy_imp ~ benefits + gender + age + education + ideology + political_interest + ai_heard_positive + ai_use + ai_awareness + knowl_bin + country, data = S2_d_benefits)

  S2_table[34,1] <- all.vars(formula(S2_9a_imp))[1]
  S2_table[34,2] <- all.vars(formula(S2_9a_imp))[2]
  S2_table[34,3] <- summary(S2_9a_imp)$coefficients[2,1]
  S2_table[34,4] <- summary(S2_9a_imp)$coefficients[2,4]

S2_9b_lik <- lm(cr_rank_lik_rev ~ benefits + gender + age + education + ideology + political_interest + ai_heard_positive + ai_use + ai_awareness + knowl_bin + country, data = S2_d_benefits)

  S2_table[35,1] <- all.vars(formula(S2_9b_lik))[1]
  S2_table[35,2] <- all.vars(formula(S2_9b_lik))[2]
  S2_table[35,3] <- summary(S2_9b_lik)$coefficients[2,1]
  S2_table[35,4] <- summary(S2_9b_lik)$coefficients[2,4]

S2_9b_imp <- lm(cr_rank_imp_rev ~ benefits + gender + age + education + ideology + political_interest + ai_heard_positive + ai_use + ai_awareness + knowl_bin + country, data = S2_d_benefits)

  S2_table[36,1] <- all.vars(formula(S2_9b_imp))[1]
  S2_table[36,2] <- all.vars(formula(S2_9b_imp))[2]
  S2_table[36,3] <- summary(S2_9b_imp)$coefficients[2,1]
  S2_table[36,4] <- summary(S2_9b_imp)$coefficients[2,4]

S2_10a <- lm(power_ai ~ existential + gender + age + education + ideology + political_interest + ai_heard_positive + ai_use + ai_awareness + knowl_bin + country, data = S2_d_existential)

  S2_table[37,1] <- all.vars(formula(S2_10a))[1]
  S2_table[37,2] <- all.vars(formula(S2_10a))[2]
  S2_table[37,3] <- summary(S2_10a)$coefficients[2,1]
  S2_table[37,4] <- summary(S2_10a)$coefficients[2,4]

S2_10b <- lm(feelings_ai ~ existential + gender + age + education + ideology + political_interest + ai_heard_positive + ai_use + ai_awareness + knowl_bin + country, data = S2_d_existential)

  S2_table[38,1] <- all.vars(formula(S2_10b))[1]
  S2_table[38,2] <- all.vars(formula(S2_10b))[2]
  S2_table[38,3] <- summary(S2_10b)$coefficients[2,1]
  S2_table[38,4] <- summary(S2_10b)$coefficients[2,4]

S2_11 <- lm(policy_support ~ existential + gender + age + education + ideology + political_interest + ai_heard_positive + ai_use + ai_awareness + knowl_bin + country, data = S2_d_existential)

  S2_table[39,1] <- all.vars(formula(S2_11))[1]
  S2_table[39,2] <- all.vars(formula(S2_11))[2]
  S2_table[39,3] <- summary(S2_11)$coefficients[2,1]
  S2_table[39,4] <- summary(S2_11)$coefficients[2,4]

S2_12a <- lm(power_ai ~ immediate + gender + age + education + ideology + political_interest + ai_heard_positive + ai_use + ai_awareness + knowl_bin + country, data = S2_d_immediate)

  S2_table[40,1] <- all.vars(formula(S2_12a))[1]
  S2_table[40,2] <- all.vars(formula(S2_12a))[2]
  S2_table[40,3] <- summary(S2_12a)$coefficients[2,1]
  S2_table[40,4] <- summary(S2_12a)$coefficients[2,4]

S2_12b <- lm(feelings_ai ~ immediate + gender + age + education + ideology + political_interest + ai_heard_positive + ai_use + ai_awareness + knowl_bin + country, data = S2_d_immediate)

  S2_table[41,1] <- all.vars(formula(S2_12b))[1]
  S2_table[41,2] <- all.vars(formula(S2_12b))[2]
  S2_table[41,3] <- summary(S2_12b)$coefficients[2,1]
  S2_table[41,4] <- summary(S2_12b)$coefficients[2,4]

S2_13 <- lm(policy_support ~ immediate + gender + age + education + ideology + political_interest +
 ai_heard_positive + ai_use + ai_awareness + knowl_bin + country, data = S2_d_immediate)

  S2_table[42,1] <- all.vars(formula(S2_13))[1]
  S2_table[42,2] <- all.vars(formula(S2_13))[2]
  S2_table[42,3] <- summary(S2_13)$coefficients[2,1]
  S2_table[42,4] <- summary(S2_13)$coefficients[2,4]

S2_14a <- lm(power_ai ~ benefits + gender + age + education + ideology + political_interest + ai_heard_positive + ai_use + ai_awareness + knowl_bin + country, data = S2_d_benefits)

  S2_table[43,1] <- all.vars(formula(S2_14a))[1]
  S2_table[43,2] <- all.vars(formula(S2_14a))[2]
  S2_table[43,3] <- summary(S2_14a)$coefficients[2,1]
  S2_table[43,4] <- summary(S2_14a)$coefficients[2,4]

S2_14b <- lm(feelings_ai ~ benefits + gender + age + education + ideology + political_interest + ai_heard_positive + ai_use + ai_awareness + knowl_bin + country, data = S2_d_benefits)

  S2_table[44,1] <- all.vars(formula(S2_14b))[1]
  S2_table[44,2] <- all.vars(formula(S2_14b))[2]
  S2_table[44,3] <- summary(S2_14b)$coefficients[2,1]
  S2_table[44,4] <- summary(S2_14b)$coefficients[2,4]

S2_15 <- lm(policy_support ~ benefits + gender + age + education + ideology + political_interest + ai_heard_positive + ai_use + ai_awareness + knowl_bin + country, data = S2_d_benefits)

  S2_table[45,1] <- all.vars(formula(S2_15))[1]
  S2_table[45,2] <- all.vars(formula(S2_15))[2]
  S2_table[45,3] <- summary(S2_15)$coefficients[2,1]
  S2_table[45,4] <- summary(S2_15)$coefficients[2,4]


S2_h <- c("H1a", "H1a", "H1b", "H1b", "H2a", "H2a", "H2b", "H2b", "H3a", "H3a", "H3b", "H3b", "H4a", "H4a", "H4b", "H4b", "H5a", "H5a", "H5b", "H5b", "H6a", "H6a", "H6b", "H6b", "H7a", "H7a", "H7b", "H7b", "H8a", "H8a", "H8b", "H8b", "H9a", "H9a", "H9b", "H9b", "H10a", "H10b", "H11", "H12a", "H12b", "H13", "H14a", "H14b", "H15")

S2_table <- S2_table %>%
  mutate(
    pval_adj = p.adjust(pval, method = "BH", n = 45),
    hypothesis = S2_h
  )

print(S2_table, n = 100)

# Study 3

S3_table <- tibble(
  outcome = NA,
  treatment = NA,
  coef = NA,
  pval = NA,
  pval_adj = NA
)

S3_1a <- lm(existential_cap5 ~ existential + gender + age + education + ideology + political_interest + ai_use + ai_awareness + knowl_bin, data = S3_d_existential)

  S3_table[1,1] <- all.vars(formula(S3_1a))[1]
  S3_table[1,2] <- all.vars(formula(S3_1a))[2]
  S3_table[1,3] <- summary(S3_1a)$coefficients[2,1]
  S3_table[1,4] <- summary(S3_1a)$coefficients[2,4]

S3_1b <- lm(existential_cap10 ~ existential + gender + age + education + ideology + political_interest + ai_use + ai_awareness + knowl_bin, data = S3_d_existential)

  S3_table[2,1] <- all.vars(formula(S3_1b))[1]
  S3_table[2,2] <- all.vars(formula(S3_1b))[2]
  S3_table[2,3] <- summary(S3_1b)$coefficients[2,1]
  S3_table[2,4] <- summary(S3_1b)$coefficients[2,4]

S3_1c <- lm(existential_occ ~ existential + gender + age + education + ideology + political_interest + ai_use + ai_awareness + knowl_bin, data = S3_d_existential)

  S3_table[3,1] <- all.vars(formula(S3_1c))[1]
  S3_table[3,2] <- all.vars(formula(S3_1c))[2]
  S3_table[3,3] <- summary(S3_1c)$coefficients[2,1]
  S3_table[3,4] <- summary(S3_1c)$coefficients[2,4]

S3_1d <- lm(existential_imp ~ existential + gender + age + education + ideology + political_interest + ai_use + ai_awareness + knowl_bin, data = S3_d_existential)

  S3_table[4,1] <- all.vars(formula(S3_1d))[1]
  S3_table[4,2] <- all.vars(formula(S3_1d))[2]
  S3_table[4,3] <- summary(S3_1d)$coefficients[2,1]
  S3_table[4,4] <- summary(S3_1d)$coefficients[2,4]

S3_2a <- lm(imminent_cap5 ~ existential + gender + age + education + ideology + political_interest + ai_use + ai_awareness + knowl_bin, data = S3_d_existential)

  S3_table[5,1] <- all.vars(formula(S3_2a))[1]
  S3_table[5,2] <- all.vars(formula(S3_2a))[2]
  S3_table[5,3] <- summary(S3_2a)$coefficients[2,1]
  S3_table[5,4] <- summary(S3_2a)$coefficients[2,4]

S3_2b <- lm(imminent_cap10 ~ existential + gender + age + education + ideology + political_interest + ai_use + ai_awareness + knowl_bin, data = S3_d_existential)

  S3_table[6,1] <- all.vars(formula(S3_2b))[1]
  S3_table[6,2] <- all.vars(formula(S3_2b))[2]
  S3_table[6,3] <- summary(S3_2b)$coefficients[2,1]
  S3_table[6,4] <- summary(S3_2b)$coefficients[2,4]

S3_2c <- lm(imminent_occ ~ existential + gender + age + education + ideology + political_interest + ai_use + ai_awareness + knowl_bin, data = S3_d_existential)

  S3_table[7,1] <- all.vars(formula(S3_2c))[1]
  S3_table[7,2] <- all.vars(formula(S3_2c))[2]
  S3_table[7,3] <- summary(S3_2c)$coefficients[2,1]
  S3_table[7,4] <- summary(S3_2c)$coefficients[2,4]

S3_2d <- lm(imminent_imp ~ existential + gender + age + education + ideology + political_interest + ai_use + ai_awareness + knowl_bin, data = S3_d_existential)

  S3_table[8,1] <- all.vars(formula(S3_2d))[1]
  S3_table[8,2] <- all.vars(formula(S3_2d))[2]
  S3_table[8,3] <- summary(S3_2d)$coefficients[2,1]
  S3_table[8,4] <- summary(S3_2d)$coefficients[2,4]

S3_3a <- lm(imminent_cap5 ~ immediate + gender + age + education + ideology + political_interest + ai_use + ai_awareness + knowl_bin, data = S3_d_immediate)

  S3_table[9,1] <- all.vars(formula(S3_3a))[1]
  S3_table[9,2] <- all.vars(formula(S3_3a))[2]
  S3_table[9,3] <- summary(S3_3a)$coefficients[2,1]
  S3_table[9,4] <- summary(S3_3a)$coefficients[2,4]

S3_3b <- lm(imminent_cap10 ~ immediate + gender + age + education + ideology + political_interest + ai_use + ai_awareness + knowl_bin, data = S3_d_immediate)

  S3_table[10,1] <- all.vars(formula(S3_3b))[1]
  S3_table[10,2] <- all.vars(formula(S3_3b))[2]
  S3_table[10,3] <- summary(S3_3b)$coefficients[2,1]
  S3_table[10,4] <- summary(S3_3b)$coefficients[2,4]

S3_3c <- lm(imminent_occ ~ immediate + gender + age + education + ideology + political_interest + ai_use + ai_awareness + knowl_bin, data = S3_d_immediate)

  S3_table[11,1] <- all.vars(formula(S3_3c))[1]
  S3_table[11,2] <- all.vars(formula(S3_3c))[2]
  S3_table[11,3] <- summary(S3_3c)$coefficients[2,1]
  S3_table[11,4] <- summary(S3_3c)$coefficients[2,4]

S3_3d <- lm(imminent_imp ~ immediate + gender + age + education + ideology + political_interest + ai_use + ai_awareness + knowl_bin, data = S3_d_immediate)

  S3_table[12,1] <- all.vars(formula(S3_3d))[1]
  S3_table[12,2] <- all.vars(formula(S3_3d))[2]
  S3_table[12,3] <- summary(S3_3d)$coefficients[2,1]
  S3_table[12,4] <- summary(S3_3d)$coefficients[2,4]

S3_4a <- lm(existential_cap5 ~ benefits + gender + age + education + ideology + political_interest + ai_use + ai_awareness + knowl_bin, data = S3_d_benefits)

  S3_table[13,1] <- all.vars(formula(S3_4a))[1]
  S3_table[13,2] <- all.vars(formula(S3_4a))[2]
  S3_table[13,3] <- summary(S3_4a)$coefficients[2,1]
  S3_table[13,4] <- summary(S3_4a)$coefficients[2,4]

S3_4b <- lm(existential_cap10 ~ benefits + gender + age + education + ideology + political_interest + ai_use + ai_awareness + knowl_bin, data = S3_d_benefits)

  S3_table[14,1] <- all.vars(formula(S3_4b))[1]
  S3_table[14,2] <- all.vars(formula(S3_4b))[2]
  S3_table[14,3] <- summary(S3_4b)$coefficients[2,1]
  S3_table[14,4] <- summary(S3_4b)$coefficients[2,4]

S3_4c <- lm(existential_occ ~ benefits + gender + age + education + ideology + political_interest + ai_use + ai_awareness + knowl_bin, data = S3_d_benefits)

  S3_table[15,1] <- all.vars(formula(S3_4c))[1]
  S3_table[15,2] <- all.vars(formula(S3_4c))[2]
  S3_table[15,3] <- summary(S3_4c)$coefficients[2,1]
  S3_table[15,4] <- summary(S3_4c)$coefficients[2,4]

S3_4d <- lm(existential_imp ~ benefits + gender + age + education + ideology + political_interest + ai_use + ai_awareness + knowl_bin, data = S3_d_benefits)

  S3_table[16,1] <- all.vars(formula(S3_4d))[1]
  S3_table[16,2] <- all.vars(formula(S3_4d))[2]
  S3_table[16,3] <- summary(S3_4d)$coefficients[2,1]
  S3_table[16,4] <- summary(S3_4d)$coefficients[2,4]

S3_5a <- lm(imminent_cap5 ~ benefits + gender + age + education + ideology + political_interest + ai_use + ai_awareness + knowl_bin, data = S3_d_benefits)

  S3_table[17,1] <- all.vars(formula(S3_5a))[1]
  S3_table[17,2] <- all.vars(formula(S3_5a))[2]
  S3_table[17,3] <- summary(S3_5a)$coefficients[2,1]
  S3_table[17,4] <- summary(S3_5a)$coefficients[2,4]

S3_5b <- lm(imminent_cap10 ~ benefits + gender + age + education + ideology + political_interest + ai_use + ai_awareness + knowl_bin, data = S3_d_benefits)

  S3_table[18,1] <- all.vars(formula(S3_5b))[1]
  S3_table[18,2] <- all.vars(formula(S3_5b))[2]
  S3_table[18,3] <- summary(S3_5b)$coefficients[2,1]
  S3_table[18,4] <- summary(S3_5b)$coefficients[2,4]

S3_5c <- lm(imminent_occ ~ benefits + gender + age + education + ideology + political_interest + ai_use + ai_awareness + knowl_bin, data = S3_d_benefits)

  S3_table[19,1] <- all.vars(formula(S3_5c))[1]
  S3_table[19,2] <- all.vars(formula(S3_5c))[2]
  S3_table[19,3] <- summary(S3_5c)$coefficients[2,1]
  S3_table[19,4] <- summary(S3_5c)$coefficients[2,4]

S3_5d <- lm(imminent_imp ~ benefits + gender + age + education + ideology + political_interest + ai_use + ai_awareness + knowl_bin, data = S3_d_benefits)

  S3_table[20,1] <- all.vars(formula(S3_5d))[1]
  S3_table[20,2] <- all.vars(formula(S3_5d))[2]
  S3_table[20,3] <- summary(S3_5d)$coefficients[2,1]
  S3_table[20,4] <- summary(S3_5d)$coefficients[2,4]

S3_6a <- lm(positive_cap5 ~ benefits + gender + age + education + ideology + political_interest + ai_use + ai_awareness + knowl_bin, data = S3_d_benefits)

  S3_table[21,1] <- all.vars(formula(S3_6a))[1]
  S3_table[21,2] <- all.vars(formula(S3_6a))[2]
  S3_table[21,3] <- summary(S3_6a)$coefficients[2,1]
  S3_table[21,4] <- summary(S3_6a)$coefficients[2,4]

S3_6b <- lm(positive_cap10 ~ benefits + gender + age + education + ideology + political_interest + ai_use + ai_awareness + knowl_bin, data = S3_d_benefits)

  S3_table[22,1] <- all.vars(formula(S3_6b))[1]
  S3_table[22,2] <- all.vars(formula(S3_6b))[2]
  S3_table[22,3] <- summary(S3_6b)$coefficients[2,1]
  S3_table[22,4] <- summary(S3_6b)$coefficients[2,4]

S3_6c <- lm(positive_occ ~ benefits + gender + age + education + ideology + political_interest + ai_use + ai_awareness + knowl_bin, data = S3_d_benefits)

  S3_table[23,1] <- all.vars(formula(S3_6c))[1]
  S3_table[23,2] <- all.vars(formula(S3_6c))[2]
  S3_table[23,3] <- summary(S3_6c)$coefficients[2,1]
  S3_table[23,4] <- summary(S3_6c)$coefficients[2,4]

S3_6d <- lm(positive_imp ~ benefits + gender + age + education + ideology + political_interest + ai_use + ai_awareness + knowl_bin, data = S3_d_benefits)

  S3_table[24,1] <- all.vars(formula(S3_6d))[1]
  S3_table[24,2] <- all.vars(formula(S3_6d))[2]
  S3_table[24,3] <- summary(S3_6d)$coefficients[2,1]
  S3_table[24,4] <- summary(S3_6d)$coefficients[2,4]

S3_h <- c("H1a", "H1b", "H1c", "H1d", "H2a", "H2b", "H2c", "H2d", "H3a", "H3b", "H3c", "H3d", "H4a", "H4b", "H4c", "H4d", "H5a", "H5b", "H5c", "H5d", "H6a", "H6b", "H6c", "H6d")

S3_table <- S3_table %>%
  mutate(
    pval_adj = p.adjust(pval, method = "BH", n = 24),
    hypothesis = S3_h
  )

print(S3_table, n = 100)


# Make tables

S1_table <- S1_table %>%
  mutate(study = "S1") %>%
  select(study, everything()) %>%
  mutate(outcome = case_when(
    outcome == "likert_immediate" ~ "Immediate risks (capability, 1-5)",
    outcome == "rank_immediate" ~ "Immediate risks (capability, rank)",
    outcome == "likert_misperception" ~ "Misperceptions (capability, 1-5)",
    outcome == "rank_misperception" ~ "Misperceptions (capability, rank)",
    outcome == "click_petition" ~ "Click petition (yes/no)",
    outcome == "likert_existential" ~ "Existential risks (capability, 1-5)",
    outcome == "rank_existential" ~ "Existential risks (capability, rank)",
    outcome == "likert_benefits" ~ "Benefits (capability, 1-5)"
  ))

S2_table <- S2_table %>%
  mutate(study = "S2") %>%
  select(study, everything()) %>%
  mutate(outcome = case_when(
    outcome == "existential_lik" ~ "Existential risks (likelihood, 1-10)",
    outcome == "existential_imp" ~ "Existential risks (impact, 1-10)",
    outcome == "er_rank_lik_rev" ~ "Existential risks (likelihood, rank)",
    outcome == "er_rank_imp_rev" ~ "Existential risks (impact, rank)",
    outcome == "imminent_lik" ~ "Immediate risks (likelihood, 1-10)",
    outcome == "imminent_imp" ~ "Immediate risks (impact, 1-10)",
    outcome == "ir_rank_lik_rev" ~ "Immediate risks (likelihood, rank)",
    outcome == "ir_rank_imp_rev" ~ "Immediate risks (impact, rank)",
    outcome == "conspiracy_lik" ~ "Misperceptions (likelihood, 1-10)",
    outcome == "conspiracy_imp" ~ "Misperceptions (impact, 1-10)",
    outcome == "cr_rank_lik_rev" ~ "Misperceptions (likelihood, rank)",
    outcome == "cr_rank_imp_rev" ~ "Misperceptions (impact, rank)",
    outcome == "power_ai" ~ "Power of AI (1-10)",
    outcome == "feelings_ai" ~ "Feelings towards AI (1-10)",
    outcome == "policy_support" ~ "Policy support (1-10)"
  ))

S3_table <- S3_table %>%
  mutate(study = "S3") %>%
  select(study, everything()) %>%
  mutate(outcome = case_when(
    outcome == "existential_cap5" ~ "Existential risks (capability, 1-5)",
    outcome == "existential_cap10" ~ "Existential risks (capability, 1-10)",
    outcome == "existential_occ" ~ "Existential risks (likelihood, 1-10)",
    outcome == "existential_imp" ~ "Existential risks (impact, 1-10)",
    outcome == "imminent_cap5" ~ "Immediate risks (capability, 1-5)",
    outcome == "imminent_cap10" ~ "Immediate risks (capability, 1-10)",
    outcome == "imminent_occ" ~ "Immediate risks (likelihood, 1-10)",
    outcome == "imminent_imp" ~ "Immediate risks (impact, 1-10)",
    outcome == "positive_cap5" ~ "Benefits risks (capability, 1-5)",
    outcome == "positive_cap10" ~ "Benefits risks (capability, 1-10)",
    outcome == "positive_occ" ~ "Benefits risks (likelihood, 1-10)",
    outcome == "positive_imp" ~ "Benefits risks (impact, 1-10)"
  ))


S123_table <- bind_rows(S1_table, S2_table, S3_table) %>%
  mutate(
    treatment = case_when(
      treatment == "existential" ~ "Existential risks",
      treatment == "immediate" ~ "Immediate risks",
      treatment == "benefits" ~ "Benefits",
      ),
    confirmed = case_when(
      study == "S1" & hypothesis == "H2a" ~ "Yes",
      study == "S1" & hypothesis == "H5a" ~ "Yes",
      study == "S1" & hypothesis == "H5b" ~ "Yes",
      study == "S1" & hypothesis == "H6" ~ "Yes",
      study == "S1" & hypothesis == "H8a" ~ "Yes",
      study == "S3" & hypothesis == "H1a" ~ "Yes",
      TRUE ~ "No"
    )) %>%
  relocate(hypothesis, .before = outcome)

print(S123_table, n = 100)


